package com.changgou.goods.feign;

import com.changgou.common.vo.Result;
import com.changgou.goods.pojo.Sku;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("goods")
@RequestMapping("/sku")
public interface SkuFeign {
    /**
     * 根据状态查询数据
     * @param status
     * @return
     */
    @GetMapping("/status/{status}")
    public Result<List<Sku>> findByStatus(@PathVariable String status);

    /***
     * 根据ID查询Sku数据
     * @param id 主键
     * @return 查询结果
     */
    @GetMapping("/{id}")
    public Result<Sku> findById(@PathVariable Long id);

    /**
     * 扣减库存
     * @param username 用户名
     * @return
     */
    @GetMapping("/decr/count")
    public Result decrCount(@RequestParam("username") String username);
}
